<template>
	<div>
		<div class="contents" style="">
			<el-tabs v-model="activeName">
				<el-tab-pane label="商品信息" name="first">
					<div>
						<p class="admin-title">
							基本信息
							<!-- <el-checkbox @change="checkState" style="margin-left: 10px;">
		          上架
		        </el-checkbox> -->
						</p>
						<el-form ref="createForm" label-width="100px" :model="addForm" style="padding-top: 15px;pointer-events:none;opacity: 0.8;">
							<el-row :gutter="20">
								<el-col :span="10">
									<el-form-item label="商品分类" prop="category_id" :rules="[
										{
										  required: true,
										  message: '请选择商品分类',
										  trigger: 'blur',
										},
									  ]">
										<goods-type ref="goodsType" :details="addForm.category_id" @selectType="changeType" :disable="disable">
										</goods-type>
									</el-form-item>
									<el-form-item label="商品名称" prop="name" :rules="[
										{
										  required: true,
										  message: '请填商品名称',
										  trigger: 'blur',
										},
									  ]">
										<el-input v-model="addForm.name" maxlength="30" placeholder="长度<30个字，必须项，如：白菜"
											show-word-limit  :disabled="disable" clearable/>
									</el-form-item>
									<el-form-item label="商品品牌" prop="brand">
										<el-input v-model="addForm.brand" maxlength="20" placeholder="长度<20个字"
											show-word-limit :disabled="disable" clearable/>
									</el-form-item>
									<el-form-item label="助记码" prop="mem_code">
										<div style="display: flex;">
											<el-input v-model="addForm.mem_code" maxlength="128" placeholder="长度<128个字"
												show-word-limit :disabled="disable" clearable/>
											<tooltip-msg messages="不填写时，系统默认为商品名称的拼音码" place="right" />
										</div>
									</el-form-item>
									<el-form-item label="采购类型" prop="purchase_type" :rules="[
											{
											  required: true,
											  message: '请选择采购类型',
											  trigger: 'blur',
											},
										  ]">
										<el-radio-group v-model="addForm.purchase_type">
											<el-radio-button label="供应商送货"></el-radio-button>
											<!-- <el-radio-button label="市场自采"></el-radio-button> -->
										</el-radio-group>
										<el-checkbox v-model="addForm.s_purchase_type_temp" style="margin-left: 10px;" :disabled="disable">
											临时指定
										</el-checkbox>
									</el-form-item>
									<el-form-item label="生产日期" prop="sctime">
										<el-date-picker v-model="addForm.sctime" type="date" placeholder="选择日期" :disabled="disable" value-format="yyyy-MM-dd" style="width: 100%;">
										</el-date-picker>
									</el-form-item>
									<el-form-item label="税收分类编码" prop="tax_type_code" style="white-space: nowrap;">
										<el-input v-model="addForm.tax_type_code" maxlength="19" placeholder="长度19位数字"
											show-word-limit :disabled="disable" clearable />
									</el-form-item>
									<el-form-item label="标签" prop="tags">
										<el-checkbox-group v-model="addForm.tags" :disabled="disable">
											<el-checkbox v-for="(item,index) in tagList" :key="index" :label="item.name"
												:value="item.name"></el-checkbox>
										</el-checkbox-group>
									</el-form-item>
									<el-form-item label="是否首页推荐" prop="is_recommend">
										<el-switch v-model="addForm.is_recommend" :active-value="1" :inactive-value="0"/>
									</el-form-item>
								</el-col>
								<el-col :span="8">
									<el-form-item label="商品编码" prop="code" :rules="[
										{
										  required: true,
										  message: '请填写商品编码',
										  trigger: 'blur',
										},
									  ]">
										<el-input v-model="addForm.code" maxlength="30" placeholder="长度<30个字，必须填"
											show-word-limit disabled clearable/>
									</el-form-item>
									<el-form-item label="商品别名" prop="alias">
										<el-input v-model="addForm.alias" maxlength="20" placeholder="长度<20个字"
											show-word-limit :disabled="disable" clearable/>
									</el-form-item>
									<el-form-item label="商品产地" prop="place">
										<!-- <el-input v-model="addForm.place" maxlength="20" placeholder="长度<20个字"
											show-word-limit :disabled="disable" clearable/> -->
										<el-cascader size="large" :props="{ checkStrictly: true }" :options="optionsT" v-model="addForm.place" @change="handleChange" placeholder="请选择地区"
											style="width: 100%;" clearable disabled>
										</el-cascader>
									</el-form-item>
									<el-form-item label="损耗率" prop="loss_rate">
										<el-input v-model="addForm.loss_rate" :disabled="disable" clearable/>
									</el-form-item>
									<el-form-item v-if="this.addForm.purchase_type == '供应商送货'" label="默认供应商"
										prop="supplier_id" :rules="[{required: true,message: '请选择供应商',trigger: 'blur',},]">
										<el-select v-model="addForm.supplier_id" placeholder="请选择" style="width: 100%;" :disabled="disable" clearable>
											<el-option v-for="item in supList" :key="item.id" :label="item.name"
												:value="item.id" />
										</el-select>
									</el-form-item>
									<el-form-item v-else label="采购员" prop="purchaser_id"
										:rules="[{required: true,message: '请选择采购员',trigger: 'blur',},]">
										<el-select v-model="addForm.purchaser_id" placeholder="请选择" style="width: 100%;" :disabled="disable" clearable>
											<el-option v-for="item in buyData" :key="item.id" :label="item.name"
												:value="item.id" />
										</el-select>
									</el-form-item>
									<el-form-item label="保质期" prop="expiration_date">
										<div style="display: flex;">
											<el-input v-model="addForm.expiration_date" placeholder="输入保质期" :disabled="disable" clearable/>
											<el-select v-model="addForm.expiration_date_unit" placeholder="请选择单位" style="width: 100%;" :disabled="disable">
												<el-option v-for="item in optionShelf" :key="item.id" :label="item.name"
													:value="item.id" />
											</el-select>
										</div>
									</el-form-item>
									<el-form-item label="包装" prop="pack">
										<el-select v-model="addForm.pack" placeholder="请选择" style="width: 100%;" :disabled="disable">
											<el-option v-for="item in optionPack" :key="item.id" :label="item.name"
												:value="item.id" />
										</el-select>
									</el-form-item>
									<el-form-item label="储存方式" prop="storage_means">
										<el-select v-model="addForm.storage_means" placeholder="请选择" style="width: 100%;" :disabled="disable">
											<el-option v-for="item in optionStorage" :key="item.id" :label="item.name"
												:value="item.id" />
										</el-select>
									</el-form-item>
								</el-col>
							</el-row>
						</el-form>
						<p class="admin-title">
							<span style="color:red;margin-left: 0;">*</span>
							商品封面
							<span>
								图片尺寸800*800px，大小≤3MB，支持JPG、PNG、JPEG，最多上传1张
							</span>
						</p>
						<div class="upload">
							<el-upload action="https://up-z2.qiniup.com" :data="formToken" :limit="1"
								accept=".JPG,.PNG,.JPEG" list-type="picture-card" :on-success="uploadfmImg"
								:before-upload="beforeAvatarUpload" :file-list="filefmList" :on-remove="delGoodsImg"
								:on-preview="handleImgPreview" :on-exceed="MorefmImg" disabled>
								<i class="el-icon-plus"></i>
							</el-upload>
							<el-dialog :visible.sync="dialogVisible">
								<img alt="" :src="dialogImageUrl" width="100%" />
							</el-dialog>
						</div>
						<p class="admin-title">
							商品图片
							<span>
								图片尺寸800*800px，大小≤3MB，支持JPG、PNG、JPEG，最多上传5张
							</span>
						</p>
						<div class="upload">
							<el-upload action="https://up-z2.qiniup.com" :data="formToken" :limit="1"
								accept=".JPG,.PNG,.JPEG" list-type="picture-card" :on-success="uploadImg"
								:before-upload="beforeAvatarUpload" :file-list="fileList" :on-remove="delGoodsImg"
								:on-preview="handleImgPreview" :on-exceed="MoreImg"
								disabled
							>
								<i class="el-icon-plus"></i>
							</el-upload>
							<el-dialog :visible.sync="dialogVisible">
								<img alt="" :src="dialogImageUrl" width="100%" />
							</el-dialog>
						</div>
					</div>
					<p class="admin-title">
						商品价格
						<span>对于一个客户，优先执行指定价，其次类型价，最后市场价</span>
					</p>
					<div style="padding-top: 15px;pointer-events:none;opacity: 0.8;">
						<el-table :data="addForm.goodsPriceList" style="width: 100%;">
							<el-table-column label="操作">
								<template slot-scope="scope">
									<el-button type="text">
										<i class="el-icon-plus" style="font-size: 18px; font-weight: 400;"
											@click="addPriceData"></i>
										<i v-if="scope.$index != 0" class="el-icon-minus"
											style="font-size: 18px; font-weight: 400;"
											@click="delPriceData(scope.$index,scope.row)"></i>
									</el-button>
								</template>
							</el-table-column>
							<el-table-column align="center" label="单位" prop="unit" width="250px">
								<!-- <template slot-scope="scope">
		            <span>基础单位</span>
		            <el-select
		              v-model="scope.row.unit"
		              placeholder="请选择"
		              @change="defaultUnit"
		            >
		              <el-option
		                v-for="item in basicList"
		                :key="item.id"
		                :label="item.name"
		                :value="item.id"
		              />
		            </el-select>
		            <el-checkbox disabled>分拣时按基础单位</el-checkbox>
		          </template> -->
								<template slot-scope="scope">
									<div v-if="scope.$index == 0">
										<span>基础单位</span>
										<el-select v-model="scope.row.unit" placeholder="请选择" @change="defaultUnit">
											<el-option v-for="item in basicList" :key="item.id" :label="item.name"
												:value="item.name" />
										</el-select>
										<el-checkbox v-model="sort" disabled>分拣时按基础单位</el-checkbox>
									</div>
									<div v-if="scope.$index != 0">
										<span>辅助单位</span>
										<div style="display: flex;align-items: center;">
											<el-select v-model="scope.row.unit" placeholder="请选择">
												<el-option v-for="item in basicList" :key="item.id" :label="item.name"
													:value="item.name" />
											</el-select>
											<span>=</span>
											<el-input v-model="scope.row.relation" />
											<span style="white-space: nowrap;" v-if="selectUnit">/{{selectUnit}}</span>
										</div>
										<!-- <span style="color:green">0元/</span> -->
									</div>
								</template>
							</el-table-column>
							<el-table-column align="center" label="描述" prop="detail" width="150px">
								<template slot-scope="scope">
									<el-input v-model="scope.row.detail" placeholder="长度<20个字" :rows="5" type="textarea" />
								</template>
							</el-table-column>
							<el-table-column label="起订量" prop="moq">
								<template slot-scope="scope">
									<el-input v-model="scope.row.moq" />
								</template>
							</el-table-column>
							<el-table-column label="最后一次进价" prop="recently_price" width="120px" />
							<el-table-column align="center" label="售卖库存" prop="stock" width="120px">
								<template slot-scope="scope">
									<el-select v-model="scope.row.one" @change="stockChange" placeholder="请选择">
										<el-option v-for="item in kcselect" :key="item.value" :label="item.label"
											:value="item.value" />
									</el-select>
									<el-input v-model="scope.row.stock"
										:disabled="scope.row.one == 0 || scope.row.one ==''" />
								</template>
							</el-table-column>
							<el-table-column label="市场价" prop="price">
								<template slot-scope="scope">
									<el-input v-model="scope.row.price" :disabled="scope.$index != 0"/>
								</template>
							</el-table-column>
							<el-table-column align="center" label="客户类型价" prop="customer" width="220px">
								<template slot-scope="scope">
									<el-form label-width="80px" v-if="scope.$index != 0">
										<el-form-item :label="item.name" v-for="(item,index) in scope.row.list" :key="index"
											style="white-space: nowrap;">
											<el-input v-model="item.price" />
										</el-form-item>
									</el-form>
								</template>
							</el-table-column> -->
							<el-table-column label="是否可售卖" prop="is_on_sale">
								<template slot-scope="scope">
									<el-switch v-model="scope.row.is_on_sale" :active-value="1" :inactive-value="0" v-if="scope.$index != 0"/>
								</template>
							</el-table-column>
						</el-table>
					</div>
					<p class="admin-title">其他信息</p>
					<el-form class="demo-form-inline" :inline="true" style="padding: 10px;pointer-events:none;opacity: 0.8;">
						<el-form-item label="商品排序">
							<el-input v-model="addForm.seq" style="width: 60px;" />
						</el-form-item>
						<!-- <el-form-item>
		        <el-radio label="1">标品</el-radio>
		        <el-radio label="2">非标品</el-radio>
		      </el-form-item> -->
						<el-form-item>
							<el-checkbox>是否时价</el-checkbox>
						</el-form-item>
						<el-form-item>
							<tooltip-msg messages="开启之后，该商品在商城显示为“时价”" place="right" />
						</el-form-item>
					</el-form>
					<p class="admin-title">体积和重量</p>
					<el-table :data="addForm.unitData" stripe style="width: 100%;pointer-events:none;opacity: 0.8;">
						<el-table-column label="单位" prop="unit" width="200px" />
						<el-table-column label="体积设置" width="600px">
							<template slot-scope="scope">
								<el-row :gutter="10" type="flex">
									<el-col>
										长
										<el-input v-model="scope.row.size_length" style="width: 120px;"></el-input>
										cm
									</el-col>
									<el-col>
										宽
										<el-input v-model="scope.row.size_width" style="width: 120px;"></el-input>
										cm
									</el-col>
									<el-col>
										高
										<el-input v-model="scope.row.size_height" style="width: 120px;"></el-input>
										cm
									</el-col>
								</el-row>
							</template>
						</el-table-column>
						<el-table-column label="重量">
							<template slot-scope="scope">
								<el-input v-model="scope.row.weight" style="width: 120px;"></el-input>
								kg
							</template>
						</el-table-column>
					</el-table>
					<p class="admin-title">
						图文详情描述
						<span>
							图片尺寸800*800px，大小≤3MB，支持JPG、PNG、JPEG，最多上传25张
						</span>
					</p>
					<div class="upload">
						<el-upload action="https://up-z2.qiniup.com" :data="formToken" list-type="picture-card"
							:on-success="uploadDetailImg" accept=".JPG,.PNG,.JPEG" :before-upload="beforeAvatarUpload"
							:limit="25" :file-list="imgDetailList" :on-remove="delGoodsImg" :on-preview="handleImgPreview"
							disabled
						>
							<i class="el-icon-plus"></i>
						</el-upload>
						<el-dialog :visible.sync="dialogVisible">
							<img alt="" :src="dialogImageUrl" width="100%" />
						</el-dialog>
					</div>
					<div style="width: 100%;margin-bottom: 20px;pointer-events:none;opacity: 0.8;">
						<el-input v-model="addForm.detail" maxlength="1000" placeholder="请输入..." :rows="7" show-word-limit
							type="textarea" />
					</div>
				</el-tab-pane>
			</el-tabs>
		</div>
		<div class="content_btn">
			<el-button type="primary"  @click="goBack">返回列表</el-button>
		</div>
	</div>
</template>

<script>
	import { handleActivePath } from '@/utils/routes'
	import { mapActions } from 'vuex'
	import TooltipMsg from '@/components/TooltipMsg.vue'
	import goodsType from '@/components/goodsType.vue'
	import { getGoodsEdit, getGoodsToken, getPack, getEditList} from '@/api/goodslist'
	import { getGoodsAddImg, getGoodsDelImg } from '@/api/goodsimg'
	import { getUnitQuery } from '@/api/profile'
	import { getList,getListTwo } from '@/api/purchase/purchase_supplier.js'
	import { getbuyerAll } from '@/api/purchase/buyerapi.js'
	import { getTagQuery } from '@/api/profile'
	import { getAllProfileType } from '@/api/customer/customerProfile'
	import { regionData,provinceAndCityData } from 'element-china-area-data'
	export default {
		components: {
			TooltipMsg,
			goodsType,
		},
		data() {
			return {
				activeName: 'first',
				disable:true,
				inself: true,
				optionsT: provinceAndCityData,
				selectedOptions: [],
				sort:true,
				addForm: {
					state: 1,
					category_id: '2',
					code: '',
					name: '',
					alias: '',
					brand: '',
					palce: '',
					mem_code: '',
					loss_rate: '',
					purchase_type: '供应商送货',
					is_purchase_type_temp: '',
					supplier_id: '',
					pack:'',
					storage_means:'',
					purchaser_id: '',
					sctime:'',
					expiration_date: '',
					expiration_date_unit:'',
					tags: [],
					is_recommend:0,
					tax_type_code: '',
					detail: '',
					seq: 0,
					goodsPriceList: [{
						delList:10086,
						unit: '',
						detail: '',
						moq: 0,
						lastprice: '',
						stock: 0,
						price: 0,
						is_on_sale: '1',
						one: '',
						list: []
					}, ],
					goodsImagelist: [],
					unitData: [],
				},
				selectUnit: '',
				fileList: [],
				imgDetailList: [],
				filefmList:[],
				options: [{
						value: '选项1',
						label: '不限制',
					},
					{
						value: '选项2',
						label: '自定义',
					},
				],
				value: '',
				dialogImageUrl: '',
				dialogVisible: false,
				goodsort: 0,
				tableData: [],
				onsale: true,
				basicList: [],
				supList: [],
				buyData: [],
				optionPack: [],
				optionStorage:[],
				optionShelf:[],
				kcselect: [{
						value: 0,
						label: '不限制',
					},
					{
						value: 1,
						label: '自定义',
					},
				],
				kcdisab: true,
				domain: 'https://cdn.weikedashi.net/',
				tagList: [],
				KhLits: [],
				formToken: {
					key: '',
					token: '',
				},
				Imgdata: {
					name: '',
					path: '',
					is_primary: 1,
					remarks: '111',
					seq: 0,
					host_name: 'weikedashi',
				},
			}
		},
		watch: {
			addForm: {
				handler: function(val, w) {},
				deep: true
			},
			'addForm.goodsPriceList'(e, w) {
				if(e[0].unit != w[0].unit){
					setTimeout( ()=>{
						this.defaultUnit(e[0].unit,1)
					},1000)
				}
			},
		},
		created() {
			this.Taginit()
			this.basicUnit()
			this.supplyList()
			this.buyerList()
			this.pack()
			this.storage()
			this.shelf()
		},
		async mounted() {
			if (this.$route.query.flag == 'edit') {
				let res = await getEditList({
					id:this.$route.query.id
				})
				this.addForm = res.data.list[0]
				this.addForm.goodsPriceList.map( e=>{
					e.list.forEach( item =>{
						if(item.price != 0){
							item.price = item.price?item.price/100:0
						}
					})
					e.price = e.price?e.price/100:0
					return e
				})
				// console.log(this.addForm, '1111111111')
				this.addForm.place = this.addForm.place?this.addForm.place.split(','):''
				this.basicUnit()
				this.disable = this.addForm.state == 1?true:false,
				this.addForm.delList = []
				// this.addForm.tags = this.addForm.tags.split(',') 
				this.addForm.tags = this.addForm.tags ? this.addForm.tags.split(',') : ''
				this.$refs.goodsType.details = res.data.list[0].category_id
				if(res.data.list[0].goodsMainImagelist.length != 0){
					res.data.list[0].goodsMainImagelist.forEach( e=>{
						this.fileList.push({
							url: e.path,
							id: e.id,
						})
					})
				}
				if(res.data.list[0].goodsStatePageImageList.length != 0){
					res.data.list[0].goodsStatePageImageList.map((item) => {
						this.filefmList.push({
							url: item.path,
							id: item.id,
							is_primary: item.is_primary,
						})
					})
				}
				if(res.data.list[0].goodsImagelist.length != 0){
					res.data.list[0].goodsImagelist.map((item) => {
						this.imgDetailList.push({
							url: item.path,
							id: item.id,
							is_primary: item.is_primary,
						})
					})
				}
			}
			this.getKH()
		},
		methods: {
			async shelf() {
				let res = await getPack({
					dict_code:'expiration_date_unit'
				})
				this.optionShelf = res.data.records
			},
			async pack() {
				let res = await getPack({
					dict_code:'pack'
				})
				this.optionPack = res.data.records
			},
			async storage() {
				let res = await getPack({
					dict_code:'storage_means'
				})
				this.optionStorage = res.data.records
			},
			async getKH() {
				const res = await getAllProfileType()
				this.KhLits = res.data
				// this.addForm.goodsPriceList[0].list = JSON.parse(JSON.stringify(this.KhLits))
			},
			stockChange(e) {
				if (e != 0) {
					this.kcdisab = false
				} else {
					this.kcdisab = true
				}
			},
			async Taginit() {
				const res = await getTagQuery({
					code: 'tag',
				})
				this.tagList = res.data
			},
			...mapActions({
				delVisitedRoute: 'tabs/delVisitedRoute',
			}),
			//获取基础单位数据
			async basicUnit() {
				const res = await getUnitQuery({
					code: 'unit',
				})
				this.basicList = res.data
			},
			//获取供应商数据
			async supplyList() {
				// let res = await getList(10, 1, {})
				// this.supList = res.list
				let res = await getListTwo()
				this.supList = res.data.supplier
			},
			//获取采购员数据
			async buyerList() {
				let data = await getbuyerAll({})
				this.buyData = data.list
			},
			changeType(data) {
				this.addForm.category_id = data[1]
			},
			defaultUnit(item,index) {
				if(index){
					var item = item
					var temp = this.basicList.find((res) => res.name == item)
					this.selectUnit = temp.name
				}else{
					var item = this.addForm.goodsPriceList[0].unit
					var temp = this.basicList.find((res) => res.name == item)
					this.selectUnit = temp.name
					this.addForm.unitData = []
					this.addForm.unitData.push({
						unit: temp.name,
						size_length: 0,
						size_width: 0,
						size_height: 0,
						weight: 0,
					})
				}
			},
			generate_key() {
				var timestamp = new Date().getTime()
				var str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
				var arr = str.split('')
				var result = ''
				for (var i = 0; i < 8; i++) {
					var n = Math.floor(Math.random() * arr.length)
					result += arr[n]
				}
				this.formToken.key = result + timestamp
			},
			async beforeAvatarUpload(file) {
				if (file.size / 1024 / 1024 > 3) {
					this.$message({
						message: '上传文件大小不能超过 3MB!',
						type: 'error'
					})
					return false
				}
				const res = await getGoodsToken()
				this.formToken.token = res.data.token
				this.generate_key()
			},
			async initAddImg(res, file) {
				const imgurl = this.domain + res.key
				this.Imgdata.path = imgurl
				this.Imgdata.name = file.name
				this.Imgdata.product_id = this.addForm.id
				this.Imgdata.product_category = this.addForm.category_id
				this.addForm.goodsImagelist.push(this.Imgdata)
				// this.Imgdata.product_id = this.addForm.id
				// this.Imgdata.product_category = this.addForm.category_id
				await getGoodsAddImg(this.Imgdata)
			},
			async uploadfmImg(res, file) {
				this.Imgdata.is_primary = 3
				this.initAddImg(res, file)
			},
			async uploadImg(res, file) {
				this.Imgdata.is_primary = 1
				this.initAddImg(res, file)
			},
			async uploadDetailImg(res, file) {
				this.Imgdata.is_primary = 2
				this.initAddImg(res, file)
			},
			handleImgPreview(file) {
				this.dialogImageUrl = file.url
				this.dialogVisible = true
			},
			checkState(sta) {
				if (sta) {
					this.addForm.state = 1
				} else {
					this.addForm.state = 0
				}
			},
			//图片超出限制
			MoreImg() {
				this.$message.warning('当前限制选择 1 个文件,需删除之前图片')
			},
			MorefmImg() {
				this.$message.warning('当前限制选择 5 长图片,需删除之前图片')
			},
			async delGoodsImg(file) {
				await getGoodsDelImg({
					id: file.id,
				})
			},
			addPriceData() {
				this.addForm.goodsPriceList.push({
					unit: '',
					detail: '',
					moq: 0,
					lastprice: '',
					stock: 0,
					price: 0,
					is_on_sale: true,
					one: '',
					is_default: 0,
					relation: 0,
					list: JSON.parse(JSON.stringify(this.KhLits)),
				})
			},
			delPriceData(index,e) {
				this.addForm.goodsPriceList.splice(index, 1)
				this.addForm.delList.push(e.id)
				// console.log(this.addForm.delList,'11111111')
			},
			handleChange(value) {
				this.addForm.place = data?data.toString():''
			},
			//保存修改
			async handleEditData() {
				this.addForm.tags = this.addForm.tags ? this.addForm.tags.toString() : ''
				const res = await getGoodsEdit(this.addForm)
				if (res.status == 200) {
					this.$notify({
						message: '修改商品成功',
						type: 'success',
					})
					const detailPath = await handleActivePath(this.$route, true)
					await this.$router.push('/goods/goodslist')
					await this.delVisitedRoute(detailPath)
				}
			},
			goBack() {
				this.$confirm('确定返回列表页面?', '确定', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning',
					})
					.then(async () => {
						const detailPath = await handleActivePath(this.$route, true)
						await this.$router.push('/goods/goodslist')
						await this.delVisitedRoute(detailPath)
					})
					.catch(() => {})
			},
		},
	}
</script>

<style scoped lang="scss">
	.contents {
		padding: 0 20px 10px;
		position: relative;

		.admin-title {
			width: 100%;
			padding: 10px;
			margin: 0;
			font-size: 16px;
			text-align: left;
			border-bottom: 1px solid #eee;

			span {
				font-size: 14px;
				margin-left: 20px;
				color: #80848f;
			}
		}

		.upload {
			margin-bottom: 10px;
			display: flex;
		}
	}
	.content_btn{
		padding: 0 20px 10px;
	}
	::v-deep .el-input__inner{
		height: 33px !important;
	}
</style>
